<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="a" style="background-color: aqua;padding: 10px;">
    <div id="b" style="background-color: yellow;padding: 10px;">
      <div id="c" style="background-color: bisque;padding: 10px;">
        <div id="d" style="background-color: red;">哈哈哈哈哈</div>
      </div>
    </div>
  </div>
  <script>
    /**
     * 2022年4月28日10:49:54
     * js 1
     * Dom事件中对Target、CurrentTaget理解
     */
    let a = document.getElementById('a')
    let b = document.getElementById('b')
    let c = document.getElementById('c')
    let d = document.getElementById('d')
    a.addEventListener('click', e => {
      const {
        target,
        currentTarget
      } = e;
      console.log(`target是${target.id}`)
      console.log(`currentTarget是${currentTarget.id}`)
    },true)
    b.addEventListener('click', e => {
      const {
        target,
        currentTarget
      } = e;
      console.log(`target是${target.id}`)
      console.log(`currentTarget是${currentTarget.id}`)
    },true)
    c.addEventListener('click', e => {
      const {
        target,
        currentTarget
      } = e;
      console.log(`target是${target.id}`)
      console.log(`currentTarget是${currentTarget.id}`)
    },true)
    d.addEventListener('click', e => {
      const {
        target,
        currentTarget
      } = e;
      console.log(`target是${target.id}`)
      console.log(`currentTarget是${currentTarget.id}`)
    },true)
  </script>
</body>

</html>
